<?php
class Impact_View_Helper_RedirectButtonControl extends Impact_View_Helper_FormControl
{
    public function redirectButtonControl($value, $url, $attributes = array())
    {
        if (empty($attributes['value'])) {
            $attributes['type'] = 'button';
        }

        if (empty($attributes['class'])) {
            $attributes['class'] = 'button';
        }

        $urlQuotesEscaped = str_replace("'", "\\'", $url);

        $attributes['value']   = $value;
        $attributes['onclick'] = "location = '".$urlQuotesEscaped."'";

        return '<input ' . $this->_buildAttributeString($attributes) . ' />';
    }
}

// vim: sw=4:ts=4:sts=4:et
